package com.windfone.service.impl;

import java.util.List;

import com.windfone.common.FileTool;
import com.windfone.dao.ProductTypeDao;
import com.windfone.model.ProductType;
import com.windfone.service.ProductTypeService;

public class ProductTypeServiceImpl implements ProductTypeService {
	private ProductTypeDao productTypeDao;
	public void setProductTypeDao(ProductTypeDao productTypeDao) {
		this.productTypeDao = productTypeDao;
	}

	public int deleteProductType(int keyValue) {
		ProductType bean = productTypeDao.getProductTypeId(keyValue).get(0);
		String suffix = bean.getImagepath();
		FileTool.dealPic(suffix );
		return productTypeDao.deleteProductType(keyValue);
	}

	public int getAllRecorderNumber() {
		return productTypeDao.getAllRecorderNumber();
	}

	public int updateProductType(ProductType bean) {
		return productTypeDao.updateProductType(bean);
	}

	public int insertProductType(ProductType bean) {
		return productTypeDao.insertProductType(bean);
	}

	public List<ProductType> getProductTypeId(int keyValue) {
		return productTypeDao.getProductTypeId(keyValue);
	}

	public List<ProductType> getAllProductType(int beginRecord) {
		return productTypeDao.getAllProductType(beginRecord);
	}

	public List<ProductType> listProductType() {
		return productTypeDao.listProductType();
	}

	public ProductType getProductTypeBYTyepName(String typeName) {
		return productTypeDao.getProductTypeBYTyepName( typeName);
	}

}
